package 强化训练;

import java.util.Scanner;

public class day22小易的升级之路 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            int n = sc.nextInt();//怪物的数量
            int f = sc.nextInt();//当前战力
            int[] arr = new int[n];//个怪物的防御值
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
            }
            for (int i = 0; i < n; i++) {
                if (f >= arr[i]){
                    f += arr[i];
                }else {
                    f += maxYS(f,arr[i]);
                }
            }
            System.out.println(f);
        }
    }
    //最大公约数
    private static int maxYS(int a,int b){
        return a % b == 0 ? b : maxYS(b,a % b);
    }
}
